<?php
namespace app\common\library\helper;

use app\common\model\Address;
use app\common\model\bm\Bj;
use app\common\model\bm\College;
use app\common\model\bm\Degree;
use app\common\model\bm\Education;
use app\common\model\bm\Gw;
use app\common\model\bm\Nation;
use app\common\model\bm\Organ;
use app\common\model\bm\Politicstype;
use app\common\model\bm\Sex;
use app\common\model\bm\Speciality;
use app\common\model\BmEducationBackground;
use app\common\model\BmPositionLevel;
use app\common\model\InstitutionType;
use think\Config;

/**
 * Class ConfigHelper
 * @package app\common\lib\helper
 * @desc 配置帮助类
 */

class ConfigHelper{

    /**
     * @desc 获取模块配置
     * @param string $section_name //模块名
     * @return mixed
     */
    public static function getModule( $section_name = '' ){

        $res = self::_getSection( "module", $section_name );

        return $res;

    }

    /**
     * @param $module_name
     * @return string
     * @desc 获取模块id
     */
    public static function getModuleId( $module_name ){

        $module_arr = self::getModule();

        $res = $module_arr[ $module_name ] ? $module_arr[ $module_name ] : '';

        return $res;

    }

    /**
     * @param $key      //键名
     * @return mixed
     * @desc 获取配置文件（extra/config）中的值
     */
    public static function getConfig( $key ){

        $config = self::_getSection( "config" );

        $res = $config[ $key ];

        return $res;
    }

    private static function _getSection( $config_name, $section_name = '' ){

        if( $section_name ){
            $section_name = '.' . $section_name;
        }

        $res = Config::get( "{$config_name}{$section_name}" );

        return $res;

    }
}